from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
from tkinter import colorchooser

root = Tk()

def askokcancel():
    messagebox.askokcancel('waring','警告')
def askquestion():
    messagebox.askquestion('waring','警告')

def open():
    fillName=filedialog.askopenfilename()
    print(fillName)
def save():
    fillName=filedialog.asksaveasfilename()
    print(fillName)
def color():
    fillName=colorchooser.askcolor()
    print(fillName)    
    
Button(root,text='1',command=askokcancel).pack()
Button(root,text='2',command=askquestion).pack()
Button(root,text='打开文件',command=open).pack()
Button(root,text='保存文件',command=save).pack()
Button(root,text='选择颜色',command=color).pack()


mainloop()
